﻿using ProtoBuf;
using System.Windows;

namespace ToyChat.BuiltinModules
{
    /// <summary>
    /// This "message" is used to send informations about a channel to a client
    /// </summary>
    [ProtoContract(Name = "Core.ChannelDescriptor")]
    public class ChannelDescriptor
    {
        /// <summary>
        /// Gets or Sets the name of the channel
        /// </summary>
        [ProtoMember(1)]
        public string ChannelName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or Sets a value indicating the number of users currently in the channel
        /// </summary>
        [ProtoMember(2)]
        public int UserCount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or Sets the ID of the channel
        /// </summary>
        [ProtoMember(4)]
        public int ChannelID { get; set; }

        /// <summary>
        /// Gets or Sets a value indicating whether or not the channel is password-protected
        /// </summary>
        [ProtoMember(3)]
        public bool IsPasswordProtected { get; set; }

        /// <summary>
        /// Overriden to provide a visual representation of this descriptor
        /// </summary>
        /// <returns>A string representation of this instance</returns>
        public override string ToString()
        {
            return string.Format("[{0}] Users: {1} Password: {2}", this.ChannelName, this.UserCount, this.IsPasswordProtected ? "Yes" : "No");
        }
    }
}